# (c) 2010 Michael Penhallegon
# All Rights Reserved


from django.contrib import admin
from dj.blog.models import Page, Article, Theme
def markAsPublished(modeladmin, request, queryset):
    shortdesc = 'Mark as public'
    queryset.update(status=3)
def markAsEditing(modeladmin, request, queryset):
    queryset.update(status=2)
markAsEditing.short_description = 'Mark as editing'
markAsPublished.short_description  = 'Mark as public'
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('title','pub_date','page')
    search_display = ('author')
    prepopulated_fields = {'slug': ('title',)}
    actions = [markAsPublished, markAsEditing]
class PageAdmin(admin.ModelAdmin):
    list_display = ('name','approved')
class ThemeAdmin(admin.ModelAdmin):
    list_display = ('name',)

admin.site.register(Page, PageAdmin)
admin.site.register(Article,ArticleAdmin)
admin.site.register(Theme,ThemeAdmin)
